//
//  M1_DES.m
//  NewMarryU
//
//  Created by apple on 2018/7/16.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "M1_DES.h"
#import <CommonCrypto/CommonDigest.h>
@implementation M1_DES

+(NSString *)m1_md5EncodingStr:(NSString *)string{
    NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
    unsigned char md[CC_MD5_DIGEST_LENGTH];
    CC_MD5_CTX context;
    CC_MD5_Init(&context);
    CC_MD5_Update(&context, [data bytes], (CC_LONG)[data length]);
    CC_MD5_Final(md, &context);
    NSMutableString *hash = [NSMutableString string];
    for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
    {
        [hash appendFormat:@"%02X", md[i]];
    }
    return [hash uppercaseString];
}
@end
